package com.woniuxy.handler;

import java.sql.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.woniuxy.pojo.DayMoney;

import com.woniuxy.pojo.MonthMoney;
import com.woniuxy.service.TurnoverService;






//营业额查询
@Controller
@RequestMapping("/turnover")
public class TurnoverHandler {
	@Resource
	private TurnoverService turnoverService;
	@RequestMapping("/findMonthMoney")
	@ResponseBody
	public List<DayMoney> findMonthMoney(){	
		
		//查询本月每一天的营业额
	    List<DayMoney> Daymoney=turnoverService.findDayMoney();
	    System.out.println(Daymoney);
	   
		return Daymoney;
	}
	
	@RequestMapping("/OneDaymoney")
	@ResponseBody
	public  List<DayMoney> OneDaymoney(String year,String month){	
		
		
	    String fristday=year+"-"+month+"-"+"01";
	    String lastday=year+"-"+month+"-"+"31";
	    //查询某月每一天营业额
	    List<DayMoney> OneDaymoney=turnoverService.findOneDayMoney(fristday, lastday);
	    System.out.println(OneDaymoney);
	  
		
		return OneDaymoney;
	}
	
	@RequestMapping("/Monthmoney")
	@ResponseBody
	public  List<MonthMoney> Monthmoney(String year){	

	    //查询某年每个月营业额
	    List<MonthMoney> Monthmoney=turnoverService.findMonthMoney(year);
		System.out.println(Monthmoney);
		
		
		return Monthmoney;
	}
}
